package game;

/**
 * Score item - has name and score.
 * @author Natchanon Hongladaromp
 *
 */
public class ScoreItem implements Comparable<ScoreItem>
{
	private String name;
	private double score;
	
	/**
	 * Construct for item.
	 */
	public ScoreItem()
	{
	}
	
	/**
	 * Construct for item.
	 * @param name name of player
	 * @param score score of player
	 */
	public ScoreItem(String name, double score)
	{
		this.name = name;
		this.score = score;
	}
	
	/**
	 * Returns name of player.
	 * @return name of player
	 */
	public String getName()
	{
		return name;
	}
	
	/**
	 * Sets name of player
	 * @param name name of player
	 */
	public void setName(String name)
	{
		this.name = name;
	}
	
	/**
	 * Returns score of player.
	 * @return score of player
	 */
	public double getScore()
	{
		return score;
	}
	
	/**
	 * Sets score of player
	 * @param score score of player
	 */
	public void setScore(double score)
	{
		this.score = score;
	}

	@Override
	public int compareTo(ScoreItem other)
	{
		if(this.score>other.score)
			return 1;
		if(this.score<other.score)
			return -1;
		return 0;
		
	}
}
